﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Threading;

namespace TaskQueueDemo
{
    public class Logger
    {
        private static ConcurrentQueue<string> logs = new ConcurrentQueue<string>();
        public static void Log(string info)
        {
            logs.Enqueue($"TID:{Thread.CurrentThread.ManagedThreadId},Time={DateTime.Now.ToString("T")}-{info}");
        }

        public static void Clear()
        {
            logs.Clear();
        }

        public static void PrintLog()
        {
            //return;
            foreach (var item in logs)
            {
                Console.WriteLine(item);
            }
        }
    }
}
